home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
haeberli
/
mtex
/
percent.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
3KB
|
117 lines
/*
* Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* percent -
* Indicate percent done on time consuming operations.
*
* Paul Haeberli - 1985
*
*/
#include "gl.h"
#include "device.h"
#define NCURSORS 11
unsigned short curtab[NCURSORS][16] = {
{0x7FFE, 0x4002, 0x2004, 0x300C,
0x2894, 0x2424, 0x2244, 0x2244,
0x2344, 0x23C4, 0x27E4, 0x2FF4,
0x3FFC, 0x3FFC, 0x4FF2, 0x7FFE},
{0x7FFE, 0x43C2, 0x2184, 0x300C,
0x2814, 0x2424, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x27E4, 0x2FF4,
0x3FFC, 0x2FF4, 0x47E2, 0x7FFE},
{0x7FFE, 0x47E2, 0x23C4, 0x308C,
0x2814, 0x2424, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x27E4, 0x2FF4,
0x3FFC, 0x27F4, 0x4182, 0x7FFE},
{0x7FFE, 0x4FE2, 0x27C4, 0x318C,
0x2914, 0x2424, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x27E4, 0x2FF4,
0x37FC, 0x23F4, 0x4082, 0x7FFE},
{0x7FFE, 0x4FF2, 0x27E4, 0x33CC,
0x2914, 0x2424, 0x2244, 0x2244,
0x2344, 0x23C4, 0x27E4, 0x2FF4,
0x37FC, 0x21C4, 0x4002, 0x7FFE},
{0x7FFE, 0x4FFA, 0x27F4, 0x33EC,
0x2994, 0x2424, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x27E4, 0x2FF4,
0x37CC, 0x2084, 0x4002, 0x7FFE},
{0x7FFE, 0x5FFA, 0x2FF4, 0x37EC,
0x2B94, 0x2424, 0x2244, 0x2244,
0x2344, 0x23C4, 0x27E4, 0x2FF4,
0x318C, 0x2004, 0x4002, 0x7FFE},
{0x7FFE, 0x7FFE, 0x3FF4, 0x37EC,
0x2BD4, 0x2424, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x27E4, 0x2BD4,
0x300C, 0x2004, 0x4002, 0x7FFE},
{0x7FFE, 0x7FFE, 0x3FFC, 0x3FFC,
0x2FD4, 0x2424, 0x2244, 0x2244,
0x2344, 0x23C4, 0x27E4, 0x2814,
0x300C, 0x2004, 0x4002, 0x7FFE},
{0x7FFE, 0x7FFE, 0x3FFC, 0x3FFC,
0x2FF4, 0x26E4, 0x2244, 0x2244,
0x22C4, 0x23C4, 0x2424, 0x2814,
0x300C, 0x2004, 0x4002, 0x7FFE},
{0x7FFE, 0x7FFE, 0x3FFC, 0x3FFC,
0x2FF4, 0x27E4, 0x23C4, 0x23C4,
0x2244, 0x2244, 0x2424, 0x2814,
0x300C, 0x2004, 0x4002, 0x7FFE},
};
static int curindex = -1;
static short oldcursor = 0;
void percentdone(long iterator, long final_iterator_plus_one)
{
int index;
unsigned short dummy;
long ldummy;
float percent;
percent = 100.0 * (float)iterator / (float)(final_iterator_plus_one - 1);
if((curindex == -1) && (percent == 0.0))
getcursor(&oldcursor,&dummy,&dummy,&ldummy);
if (percent > 99.9) {
setcursor(oldcursor,0xfff,0xfff);
curindex = -1;
} else {
index = percent*NCURSORS/100.0;
if (index<0)
index = 0;
if (index>=NCURSORS)
index = NCURSORS-1;
if (index != curindex) {
defcursor(20,curtab[index]);
curorigin(20,7,7);
setcursor(20,0xfff,0xfff);
curindex = index;
}
}
}